gint idx)
{
GtkWidget *box;
- GList *children;
GtkWidget *child;
+ int pos;
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (box == NULL)
return FALSE;
- children = gtk_container_get_children (GTK_CONTAINER (box));
- child = g_list_nth_data (children, idx);
- g_list_free (children);
- if (child)
+ for (child = gtk_widget_get_first_child (box), pos = 0;
+ child != NULL && pos < idx;
+ child = gtk_widget_get_next_sibling (child), pos++) ;
+
+ if (child && pos == idx)
{
gtk_flow_box_select_child (GTK_FLOW_BOX (box), GTK_FLOW_BOX_CHILD (child));
return TRUE;
}
+
return FALSE;
}
gint idx)
{
GtkWidget *box;
- GList *children;
GtkWidget *child;
+ int pos;
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (box == NULL)
return FALSE;
- children = gtk_container_get_children (GTK_CONTAINER (box));
- child = g_list_nth_data (children, idx);
- g_list_free (children);
- if (child)
+ for (child = gtk_widget_get_first_child (box), pos = 0;
+ child != NULL && pos < idx;
+ child = gtk_widget_get_next_sibling (child), pos++) ;
+
+ if (child && pos == idx)
{
gtk_flow_box_unselect_child (GTK_FLOW_BOX (box), GTK_FLOW_BOX_CHILD (child));
return TRUE;
}
+
return FALSE;
}
gtk_frame_set_child (GTK_FRAME (frame), widget);
g_object_set_data_full (G_OBJECT (frame), "id", (gpointer)g_strdup (text), g_free);
- gtk_container_add (GTK_CONTAINER (flowbox), frame);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), frame, -1);
g_free (text);
}
if (i % 5 == 0)
gtk_container_add (GTK_CONTAINER (box), gtk_switch_new ());
- gtk_container_add (GTK_CONTAINER (flowbox), frame);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), frame, -1);
if (!sensitive)
gtk_widget_set_sensitive (gtk_widget_get_parent (frame), FALSE);
}
for (i = 0; i < 50; i++)
{
widget = gtk_button_new_with_label ("Button");
- gtk_container_add (GTK_CONTAINER (flowbox), widget);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), widget, -1);
widget = gtk_widget_get_parent (widget);
gtk_widget_set_can_focus (widget, FALSE);
}
gtk_label_set_width_chars (GTK_LABEL (widget), 10);
g_object_set_data_full (G_OBJECT (frame), "id", (gpointer)g_strdup (strings[i]), g_free);
- gtk_container_add (GTK_CONTAINER (flowbox), frame);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), frame, -1);
}
}
static void
populate_items (GtkFlowBox *flowbox)
{
- GList *children, *l;
-
- /* Remove all children first */
- children = gtk_container_get_children (GTK_CONTAINER (flowbox));
- for (l = children; l; l = l->next)
- {
- GtkWidget *child = l->data;
+ GtkWidget *child;
- gtk_container_remove (GTK_CONTAINER (flowbox), child);
- }
- g_list_free (children);
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (flowbox))))
+ gtk_flow_box_remove (flowbox, child);
if (items_type == SIMPLE_ITEMS)
populate_flowbox_simple (flowbox);